package day03;

import java.util.Deque;
import java.util.LinkedList;

public class DequeDemo {
    public static void main(String[] args) {
    Deque <String> deque = new LinkedList<>();
    deque.offer("tom");
    deque.offerLast("jack");
    deque.offerFirst("andy");
        System.out.println(deque);
        String str = deque.poll();//从队首出队并删除
//        str= deque.pollFirst();//从队首出队并删除
//        str =deque.pollLast();//从队尾出队并删除
//       String str = deque.peek();//从队首获取，不删除
//        str=deque.peekFirst();//从队首获取，不删除
//        str= deque.peekLast();//从队尾获取，不删除
        System.out.println("获取到的元素"+str);
        System.out.println("出队的是："+str);
        str=deque.pollFirst();
        System.out.println("出队的是："+str);
        System.out.println(deque);
    }
}
